<script setup lang="ts">
import { ref } from 'vue';
const age = ref(18)
const changeAge = () => {
  age.value++
  console.log(age.value);
}
</script>


<template>
  <div id="app">
    <!-- 1. 内联语句 -->
    <p>年龄: {{ age }}</p>
    <!-- <button v-on:click="age++">点我</button> -->
    <!-- v-on: 简写成 @ -->
    <!-- <button @click="age++">点我</button> -->
    <!-- 2. 处理函数 -->
    <button @click="changeAge">点我</button>
  </div>
</template>